package com.atguigu.principle.DependenceInversion;

import java.util.regex.Pattern;

public class DependceInversion2 {
    public static void main(String[] args) {
        Person2 person2=new Person2();
        person2.sendInfo(new Email());
        person2.sendInfo(new WeChat());
    }

}
interface IReceiver{
    String getInfo();
}
 class  Email implements IReceiver{

     @Override
     public String getInfo() {
         return "发送Emial消息";
     }
 }


 class WeChat implements IReceiver{

     @Override
     public String getInfo() {
         return "微信发送消息";
     }
 }

 class Person2{
   void sendInfo(IReceiver receiver){
       System.out.println(receiver.getInfo());
    }
 }

